const SYSTEM_INFO = uni.getSystemInfoSync(); // 获取系统信息

// 获取状态栏高度
export const getStatusBarHeight = ()=> SYSTEM_INFO.statusBarHeight || 50; 

export const getTitleBarHeight = () => {
  if (uni.getMenuButtonBoundingClientRect) {
    const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
    if (!menuButtonInfo) return 40; // 如果返回 undefined，使用默认值
    const { top, height } = menuButtonInfo;
    return height + (top - getStatusBarHeight()) * 2;
  } else {
    return 40; // 方法不存在时，返回默认值
  }
};

export const  getNavBarHeight = ()=> getStatusBarHeight()+getTitleBarHeight();

export const getLeftIconLeft = ()=> {
	// #ifdef MP-TOUTIAO
		let {leftIcon:{left,width}}  = tt.getCustomButtonBoundingClientRect();
		return left+ parseInt(width);
	// #endif
	
	// #ifndef MP-TOUTIAO
		return 0
	// #endif	
}